<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <p>有了const之后，JS终于有了真正的常量。</p>
    <p>const除了有let的特性以外，多了两个特性</p>
    <ul>
        <li>const申明的变量，必须赋予初始值。</li>
        <li>const申明的变量，不能修改值。</li>
    </ul>
</body>
<script>
    const a = 123;
    // a = 34;

    const arr = [];
    arr[0] = 123;
    arr.push(345);

    const obj = {};
    obj.name = "Hydra";
    // obj = {}; // 错误
    const d = obj;
</script>
</html>